<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
<link rel="stylesheet" href="/wk1un9/houTai/lib/layui/css/layui.css" />
</head>
<body>
<form class="layui-form" action="">
  
<!--  公司介绍 -->
  <div class="layui-form-item layui-form-text">
    <label class="layui-form-label">公司介绍</label>
    <div class="layui-input-block">
      <textarea name="homeInfo" placeholder="" class="layui-textarea"  id="homeInfo" lay-verify="content">
      ${us.homeInfo} 
      </textarea> 
    </div>
  </div>
 <!--公司详细介绍  --> 
  <div class="layui-form-item layui-form-text">
    <label class="layui-form-label">公司详情</label>
    <div class="layui-input-block">
      <textarea name="info" placeholder=""    class="layui-textarea" id="info"  lay-verify="content">
       ${us.info} 
      </textarea>
    </div>
  </div>
  <!--企业文化  --> 
  <div class="layui-form-item layui-form-text">
    <label class="layui-form-label">企业文化</label>
    <div class="layui-input-block">
      <textarea name="culture" placeholder="" class="layui-textarea" >      
        ${us.culture} 
      </textarea>
    </div>
  </div>
 <!-- 联盟电话 --> 
  <div class="layui-form-item">
    <label class="layui-form-label">联盟电话</label>
    <div class="layui-input-block">
      <input type="text" name="zsTel"   value=" ${us.zsTel} " required  lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
    </div>
  </div>
  <!--联系电话  -->
  <div class="layui-form-item">
    <label class="layui-form-label">联系电话</label>
    <div class="layui-input-block">
      <input type="text" name="lxTel"  value=" ${us.lxTel}" required  lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
    </div>
  </div>
  <!--邮箱地址  -->
   <div class="layui-form-item">
    <label class="layui-form-label">邮箱地址</label>
    <div class="layui-input-block">
      <input type="text" name="email" value=" ${us.email}"   required  lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
    </div>
  </div>
  <!--公司地址  -->
   <div class="layui-form-item">
    <label class="layui-form-label">公司地址</label>
    <div class="layui-input-block">
      <input type="text" name="address" value=" ${us.address}"   required  lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
    </div>
  </div>
  
  <div class="layui-form-item">
    <div class="layui-input-block">
    
     
      <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
      <button type="reset" class="layui-btn layui-btn-primary">重置</button>
    </div>
  </div>
</form>

<script type="text/javascript" src="/wk1un9/houTai/lib/layui/layui.js"></script>

<script>
			//Demo
			layui.use( ['form','layedit'], function() {
				var form = layui.form;
				var $ = layui.jquery; //引入jquery
				 var layedit = layui.layedit;
				 var a=	layedit.build('homeInfo'); //建立编辑器
				 var b=	layedit.build('info'); //建立编辑器
			
				 form.verify({//提交之前同步富文本编辑器到本域
					 content:function(value){
						 return layedit.sync(a),layedit.sync(b);
					 }	 
				 });
				 
				 
				//监听提交
					form.on('submit(formDemo)', function(data) {
						var d = data.field; //表单中的数据，定义一个对象来接收
						d.method = "update"; // 我的密匙、大家用你们自己的
						//通过ajax向数据库提交数据了
						var url = '/wk1un9/HomeInfoServlet';
						//确保数据没有问题就进行ajax提交了
						$.post(url, d,
							function(data) {
								if(data.count>0){
									 layer.msg('修改成功');
									 
									 window.location.reload();//刷新页面
								}
							}, "json");
					return false;
				});
			});
		</script>
</body>
</html>